<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>YK Value-added System</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link rel="stylesheet" type="text/css" href="<%=basePath%>css/style.css">
	<link rel="stylesheet" type="text/css" href="<%=basePath%>css/admin.css" />
	<link rel="stylesheet" type="text/css" href="<%=basePath%>css/common.css" />
	<script src="<%=basePath%>js/sys/validate.js" type="text/javascript"></script>
	<script src="<%=basePath%>js/json.js" type="text/javascript"></script>
	<script src="<%=basePath%>js/prototype.js" type="text/javascript"></script>
	<script type="text/javascript" charset="utf-8" defer="defer" src="<%=basePath%>js/wdatepicker/WdatePicker.js"></script>
	<script type="text/javascript">
		var judgment;
		function check(){
			if(document.getElementById("name").value==""){
				alert("角色名称不能为空！");
				document.getElementById("name").focus();
				return false ;
			}
			var judgment;
			var name=encodeURIComponent(document.getElementById("name").value);
			var url ="<%=basePath%>admin/system/rightsMgmt/groups!checkGroupsByName.action?name="+name;
	        new Ajax.Request(url,{method:'post',asynchronous:false,
	           	onComplete:function(json){
	           	judgment=json.responseText.parseJSON().judgment;
			    if(judgment=="0"){
			    	alert("该群组名已经存在！");
			    }
	           }
	        });
	        if(judgment=="0"){
		        return false;
	        }else{
	         	return true;
	        }
		}
	</script>
  </head>
  
  <body>
<table width="95%" border="0" align="center" cellspacing="0">
  <tr>
    <td height="30"><table width="100%" border="0">
      <tr>
        <td width="30"><img src="images/location_left.gif" width="24" height="30" /></td>
        <td>
        	您当前的位置是：群组管理 -&gt;增加群组<br>
        </td>
      </tr>
      <tr>
          <td colspan="2"><hr width="36%" align="left"></td>
		</tr>
    </table></td>
  </tr>
  <tr>
    <td><form id="form1" name="form1" method="post" action="<%=basePath%>admin/system/rightsMgmt/groups!addGroups.action" onsubmit="return check();">
      <table width="60%" border="0" cellspacing="3">
      <tr>
          <td><font color="red" style="font-size:12px;"></font></td>
         <td>
          <font color="red" style="font-size:12px;"><s:actionmessage/><s:actionerror/></font>
          </td>
		</tr>
		<tr>
          <td align="right">
          	<span class="style">*</span>群组名称：
          </td>
          <td>
          	<input type="text" style="width:200px" id="name" name="name" value="" maxlength="50"
          		onfocus="currentBackgroundColor=this.style.backgroundColor;this.style.background='#FFFF99';" 
				onblur="this.style.backgroundColor=currentBackgroundColor;" style="height: 25px;"/>   
          </td>
         </tr>
         <tr>
          <td width="5%" align="right">
          	<span class="style">*</span>是否可用：
          </td>
          <td width="15%">
			<input type="radio" name="active" id="active" value="Y" checked/>可用
		   	<input type="radio" name="active" id="active" value="N"/>不可用
          </td>
        </tr>
		<tr>
          <td colspan="4"><hr width="60%" align="left"></td>
		</tr>
        <tr>
          <td align="right"><input type="submit" name="Submit" value="增加" class="Button" /></td>
          <td><input type="button" name="Submit22" value="返回" class="Button"  onclick="history.back();"/></td>
        </tr>
      </table>
        </form>
    </td>
  </tr>
</table>
</body>
</html>
